package com.fy.springmvc2.controller;

import com.fy.springmvc2.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttributes;

@RestController
@SessionAttributes({"user"})
@RequestMapping("/json")
public class JsonController {

    @RequestMapping("t1")
    public User t1() {
        System.err.println("....");
        User user = new User();
        user.setName("张三");
        user.setPassword("123");
        return user;
    }

    @RequestMapping("t2")
    public User t2(User user) {
        System.out.println(user);
        return user;
    }

    @RequestMapping(value = "t3",produces = "text/html;charset=utf-8")
    public String t3() {
        return "嘻嘻哒";
    }
}

